testsuite: Fix listbox tests
authorMatthias Clasen <mclasen@redhat.com>
Sat, 9 May 2020 03:03:53 +0000 (23:03 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Tue, 12 May 2020 02:21:39 +0000 (22:21 -0400)
When moving from gtk_container_forall to the widget dom
api, we are now iterating over all children of the listbox,
including headers, separators, etc. So, skip everything
that is not a listboxrow, to make the tests work again.

testsuite/gtk/listbox.c

index 0c646bd5d333abed319288a77d596c876b3e8d80..88b24108ebe965e5412c5d60c599f157ba9cf605 100644 (file)
@@ -32,6 +32,9 @@ check_sorted (GtkListBox *list)
        row != NULL;
        row = gtk_widget_get_next_sibling (row))
     {
+      if (!GTK_IS_LIST_BOX_ROW (row))
+        continue;
+
       index = gtk_list_box_row_get_index (GTK_LIST_BOX_ROW (row));
       label = gtk_list_box_row_get_child (GTK_LIST_BOX_ROW (row));
       value = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (label), "data"));
@@ -292,6 +295,9 @@ check_filtered (GtkListBox *list)
        row != NULL;
        row = gtk_widget_get_next_sibling (row))
     {
+      if (!GTK_IS_LIST_BOX_ROW (row))
+        continue;
+
       if (gtk_widget_get_child_visible (row))
         count++;
     }
@@ -381,6 +387,9 @@ check_headers (GtkListBox *list)
        row != NULL;
        row = gtk_widget_get_next_sibling (row))
     {
+      if (!GTK_IS_LIST_BOX_ROW (row))
+        continue;
+
       if (gtk_list_box_row_get_header (GTK_LIST_BOX_ROW (row)) != NULL)
         count++;
     }